package cc.utils;

import java.lang.*;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.ParserAdapter;
import org.xml.sax.helpers.XMLReaderFactory;

public class MessageParser extends DefaultHandler {
    String lang = null, fileName = "";
    String langName="";
    public MessageParser() {
    
    }

    public void startDocument() throws SAXException {
    }

    public void startElement(String uri, String local, String raw, 
                             Attributes attrs) throws SAXException {


        if (raw.equals("Language")) {
                if (attrs.getValue(2).equalsIgnoreCase("true")){
                    fileName = fileName + attrs.getValue(1) + ",";
                    langName = langName + attrs.getValue(0) + ",";
                }
        }

    }
    
    public void endDocument() throws SAXException{
        fileName = fileName.substring(0,fileName.length()-1);
        langName = langName.substring(0,langName.length()-1);
    }
}


